<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="HeaderInfo">
	
using System;
using System.Data;
using System.Configuration;
using System.Web;

namespace <xsl:value-of select="ProjectName"/>.Web.NHibernate
{
    public class SessionModule : IHttpModule
    {
       

        public void Dispose ( )
        {
            throw new Exception ( "The method or operation is not implemented." );
        }

        public void Init ( HttpApplication context )
        {
            context.BeginRequest += new EventHandler ( context_BeginRequest );
            context.EndRequest += new EventHandler ( context_EndRequest );
        }

        void context_EndRequest ( object sender , EventArgs e )
        {
            try
            {
                <xsl:value-of select="ProjectName"/>.Data.NHibernateDal.SessionManager.Instance.CommitTransaction ( );
            }
            finally
            {
                <xsl:value-of select="ProjectName"/>.Data.NHibernateDal.SessionManager.Instance.CloseSession ( );
            }
        }

        void context_BeginRequest ( object sender , EventArgs e )
        {
            <xsl:value-of select="ProjectName"/>.Data.NHibernateDal.SessionManager.Instance.BeginTransaction ( );
        }

       
    }
}



	</xsl:template>

</xsl:stylesheet>
